<!DOCTYPE html>
<html lang="en">
<head>
    <title>Calorie Search - Heart of Food</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="scripts/checklogin.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bcryptjs/2.4.3/bcrypt.min.js"></script>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.3/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.3/js/bootstrap.js" crossorigin="anonymous"></script>
    <style>
        body { 
            background-color: #f8f9fa; 
            font-family: 'Inter', sans-serif; 
        }

        .main-container {
            max-width: 800px;
            margin: 3rem auto;
            padding: 2rem;
            background: white;
            border-radius: 20px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        }

        #searchInput {
            border-radius: 25px;
            padding: 0.8rem 1.5rem;
            font-size: 1rem;
            border: 2px solid #e5e7eb;
        }

        #searchBtn {
            border-radius: 25px;
            padding: 0.8rem 2rem;
            margin-left: 0.5rem;
            background: #2a9d8f;
            border: none;
            transition: all 0.2s ease;
        }

        #searchBtn:hover {
            background: #268d81;
            transform: scale(1.02);
        }

        .search-history {
            margin-top: 2rem;
            padding-top: 1.5rem;
            border-top: 2px solid #f3f4f6;
        }

        .history-item {
            padding: 1rem;
            margin: 0.8rem 0;
            background: #f8f9fa;
            border-radius: 10px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 1rem;
        }

        .history-time {
            color: #6b7280;
            font-size: 0.9rem;
        }

        .popular-foods {
            margin-top: 2rem;
        }

        .popular-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
            gap: 1rem;
            margin-top: 1rem;
        }

        .popular-item {
            padding: 1rem;
            background: white;
            border: 1px solid #e5e7eb;
            border-radius: 10px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .popular-item:hover {
            background: #2a9d8f0a;
            transform: translateY(-2px);
        }

        .total-calories {
            margin-top: 2rem;
            padding: 1.5rem;
            background: #e9c46a1a;
            border-left: 4px solid #e9c46a;
            border-radius: 10px;
            font-size: 1.2rem;
            font-weight: 600;
        }
    </style>
</head>
<body>
    <!-- Navbar Placeholder -->
    <nav id="navbarPlaceholder"></nav>

    <div class="container main-container">
        <div class="d-flex align-items-center">
            <input type="text" 
                   class="form-control flex-grow-1" 
                   id="searchInput" 
                   placeholder="Enter food name (e.g., apple, beef)">
            <button class="btn btn-primary" id="searchBtn">Search</button>
        </div>

        <div class="search-history">
            <h5 class="text-muted">Recent Searches</h5>
            <div id="historyList"></div>
        </div>

        <div class="popular-foods">
            <h5 class="text-muted">Popular Foods</h5>
            <div class="popular-grid" id="popularList"></div>
        </div>

        <div class="total-calories">
            Total Calories Consumed: <span id="totalCalorie">0</span> kcal
        </div>
    </div>

    <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script src="./scripts/skeleton.js"></script>
    <script src="./scripts/script.js"></script>
</body>
</html>